<title>JavaScript functions</title>

<h1><center>JavaScript objects<center></h1>

<ul>
<li><a href="#script_report_engine">Script Report Engine</a>
    <ul>
    <li><a href="#sr_engine">sr.engine</a></li>
    </ul>
</li>
<li><a href="#script_repost">Script Report</a>
    <ul>
    <li><a href="#sr_report">sr.report</a></li>
    <li><a href="#sr_report_paper">sr.report.paper</a></li>
    <li><a href="#sr_report_paper_margins">sr.report.paper.margins</a></li>
    <li><a href="#sr_report_paper_size">sr.report.paper.size</a></li>
    </ul>
</li>
<li><a href="#sql_plugin">Sql plugin</a>
    <ul>
    <li><a href="#sr_sql">sr.sql</a></li>
    <li><a href="#database">Database</a></li>
    <li><a href="#scriptableerror">ScriptableError</a></li>
    <li><a href="#query">Query</a></li>
    <li><a href="#record">Record</a></li>
    </ul>
</li>
<li><a href="#internationalization_plugin">Internationalization plugin</a>
    <ul>
    <li><a href="#sr_i18n">sr.i18n</a></li>
    <li><a href="#locale">Locale</a></li>
    <li><a href="#translator">Translator</a></li>
    </ul>
</li>
</ul>

<a name="script_report_engine"></a>
<h2>Script Report Engine</h2>

<a name="sr_engine"></a>
<h3>sr.engine</h3>

<p>Class for interact with the script engine and to do basic operations.</p>

<p><b>List of basics commands:</b></p>
<table style="border-color:#bbb; border-style:solid;" border="0" cellpadding="2" cellspacing="1">
<thead>
<tr style="background: #96E066;">
    <th align="center">Method</th>
    <th align="center">Description</th>
</tr>
</thead>
<tbody>
<tr style="background: #f0f0f0;"><td><tt><b>error</b>([message, ...])</tt></td><td>print a message in the standard error.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>exit</b>()               </tt></td><td>exit the shell with return code 0 (zero).</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>exit</b>(code)           </tt></td><td>exit the shell with return number code pased as the argument <tt>code</tt>.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>getFromEnvironment</b>(name)</tt></td><td>search for a variable identified by <tt>name</tt> and returns its value or null if is not found.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>help</b>()               </tt></td><td>display this help with the basic usage.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>importExtension</b>([name, ...])</tt></td><td>load the extension(s) with name <tt>name</tt>.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>load</b>([filename, ...])</tt></td><td>load and excute the javascrip file(s) with name <tt>name</tt> inside the current shell.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>print</b>([message, ...])</tt></td><td>print a mensagge(s) in the standard output.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>quit</b>()               </tt></td><td>exit the shell with return code 0 (zero).</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>read</b>([message, ...]) </tt></td><td>read a line from the standard input. If a message this will be printed an then will read the input.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>readFile</b>(name)       </tt></td><td>read all content of a file.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>runCommand</b>(commandName, [arg, ...] [options])</tt></td><td>execute the specified command with the given argument and options as a separate process and return the exit status of the process. See <tt>runCommand</tt> usage for more detail.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>runCommand</b>(options)  </tt></td><td>execute the specified command in the options object as a separate process and return the exit status of the process. See <tt>runCommand</tt> usage for more detail.</td></tr>
</tbody>
</table>

<p><b>List of basic properties (exposed as a readonly variables):</b></p>
<table style="border-color:#bbb; border-style:solid;" border="0" cellpadding="2" cellspacing="1">
<thead>
<tr style="background: #96E066;">
    <th align="center">Method</th>
    <th align="center">Description</th>
</tr>
</thead>
<tbody>
<tr style="background: #f0f0f0;"><td><tt><b>arguments</b></tt></td><td>list of all argumets given at the command line when the shell was invoked.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>availableExtensions</b></tt></td><td>list of all avaiable QtScript' extensions.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>importedExtensions</b></tt></td><td>list of all imported QtScript' extensions.</td></tr>
<tr style="background: #e4e4e4;"><td><tt><b>qtVersion</b></tt></td><td>version of the Qt library in use.</td></tr>
<tr style="background: #f0f0f0;"><td><tt><b>srVersion</b></tt></td><td>version of the shell, value 0.1.</td></tr>
</tbody>
</table>

<p><b>runCommand() usage:</b></p>
<blockquote><tt>
    <b>runCommand</b>(command)<br>
    <b>runCommand</b>(command, arg1, ..., argN)<br>
    <b>runCommand</b>(command, arg1, ..., argN, options)<br>
    <b>runCommand</b>(options)
</tt></blockquote>

<blockquote>
    All except the last arguments to runCommand are converted to strings and
    denote command name and its arguments. If the last argument is a JavaScript
    object, it is an option object. Otherwise it is converted to string denoting
    the last argument and options objects assumed to be empty.
</blockquote>

<blockquote>
    The following properties of the option object are processed:
    <table style="border-color:#bbb; border-style:solid;" border="0" cellpadding="2" cellspacing="1">
    <thead>
    <tr style="background: #96E066;">
       <th align="center">Method</th>
       <th align="center">Description</th>
    </tr>
    </thead>
    <tbody>
    <tr style="background: #f0f0f0;"><td><tt><b>args</b></tt></td><td>provides an array of additional command arguments.</td></tr>
    <tr style="background: #e4e4e4;"><td><tt><b>env</b></tt></td><td>A JavaScript object with the properties to add to the process environment. All its enumeratable properties define the corresponding environment variable names.</td></tr>
    <tr style="background: #f0f0f0;"><td><tt><b>input</b></tt></td><td>the process input. A string sent to the process as its input. If not specified, no input is provided to the process.</td></tr>
    <tr style="background: #e4e4e4;"><td><tt><b>output</b></tt></td><td>the process output. If it is specified, the process output is read, converted to a string, appended to the output property value converted to string and put as the new value of the output property.</td></tr>
    <tr style="background: #f0f0f0;"><td><tt><b>err</b></tt></td><td>the process error output. If it is specified, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property.</td></tr>
    <tr style="background: #e4e4e4;"><td><tt><b>command</b></tt></td><td>command name. Only used if the command name is not passed as argument of the runCommand method.</td></tr>
    <tr style="background: #f0f0f0;"><td><tt><b>result</b></tt></td><td>exit statud of the process. If it is specified, the exit statud of the process will be stetted in this property.</td></tr>
    </tbody>
    </table>
</blockquote>

<p><b>Properties:</b></p>

<blockquote>
    <tt>QStringList <b>arguments</b></tt> (Read only)<br>
    <tt>QStringList <b>availableExtensions</b></tt> (Read only)<br>
    <tt>QStringList <b>importedExtensions</b></tt> (Read only)<br>
    <tt>QString <b>qtVersion</b></tt> (Read only)<br>
    <tt>QString <b>srVersion</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    QString <b>getFromEnvironment</b>(QString name);<br>
    void <b>importExtension</b>([QString name, ...]);<br>
    void <b>installApplicationTranslatorFunctions</b>(QScriptValue object = QScriptValue());<br>
    void <b>load</b>([QString fileName, ...]);<br>
    QString <b>readFile</b>(QString name);<br>
    int <b>runCommand</b>([options]);<br>
    int <b>runCommand</b>(QString commandName, [QString arg, ...], [options]);
</tt></blockquote>

<p><b>Methods only avaiable in shell:</b></p>

<blockquote><tt>
    void <b>error</b>([message, ...]);<br>
    void <b>exit</b>(int returnCode = 0);<br>
    void <b>help</b>();<br>
    void <b>print</b>([message, ...]);<br>
    void <b>quit</b>();<br>
    QString <b>read</b>([message, ...]);
</tt></blockquote>

<a name="script_report"></a>
<h2>Script Report</h2>

<a name="sr_report"></a>
<h3>sr.report</h3>

<p>Class for configure the report. The <tt>title</tt> property set the report title, used for set the print job name;
the <tt>page</tt> property return the current page number, the <tt>pageCount</tt> property return the number the pages of the document.
The <tt>isEditing</tt> property tells if the editing mode is enable (e.g. inside the Script Report Editor), the <tt>isFinal</tt> tells
if the editing mode is not enabled; the <tt>isDebbuging</tt> tells if the debbuging mode is enabled (e.g. running the debbuger
inside the Script Report Editor).</p>

<p>The method <tt>addImageResource</tt> try to add a image as a resource (if the image object is supported or can be transformed to a image),
if the <tt>url</tt> is null an unique url will be generated for the image otherwise the <tt>url</tt> value is used. Return the url asigned
to the image or null if fail getting or transforming the image. The supported <tt>image</tt> object are <tt>QImage</tt>, <tt>QPicture</tt>
(automatically transformed to <tt>QPixmap</tt>), <tt>QPixmap</tt> and <tt>QWidget</tt> (automatically transformed to <tt>QPixmap</tt>), also
<tt>image</tt> can be the url to the image file, all image format supported by <tt>QPixmap</tt> are supported, additionally, <tt>QPicture</tt>
file format are supported (with extension <tt>.pic</tt> or <tt>.PIC</tt>).</p>

<p>Example of <tt>addImageResource</tt> usage:</p>
<blockquote><tt>
    <b>var</b> src = sr.report.addImageResource(<b>new</b> QPushButton("Hello!"));<br>
    ...<br>
    &lt;<b>img</b> <b>src</b>="${src}" /&gt;
</tt></blockquote>

<p><b>Note:</b> You can just print the image object inside the report (only print image object, not load from the image url), example:</p>
<blockquote><tt>
    &lt;<b>img</b> <b>src</b>="${<b>new</b> QPushButton("Hello!")}" /&gt;
</tt></blockquote>

<p><b>Properties:</b></p>

<blockquote>
    <tt>bool <b>isEditing</b></tt> (Read only)<br>
    <tt>bool <b>isDebbuging</b></tt> (Read only)<br>
    <tt>bool <b>isFinal</b></tt> (Read only)<br>
    <tt>QString <b>page</b></tt> (Read only)<br>
    <tt>QString <b>pageCount</b></tt> (Read only)<br>
    <tt>Paper <b>paper</b></tt> (Read only)<br>
    <tt>QString <b>title</b></tt> (Read - Write)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    void <b>writeContent</b>([html, ...]);<br>
    void <b>writeFooter</b>([html, ...]);<br>
    void <b>writeFooterFirst</b>([html, ...]);<br>
    void <b>writeFooterLast</b>([html, ...]);<br>
    void <b>writeHeader</b>([html, ...]);<br>
    void <b>writeHeaderFirst</b>([html, ...]);<br>
    void <b>writeHeaderLast</b>([html, ...]);<br>
    QString <b>addImageResource</b>(image, QString url = null);
</tt></blockquote>

<a name="sr_report_paper"></a>
<h3>sr.report.paper</h3>

<p>Class for configure the report's paper.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>PaperMargins <b>margins</b></tt> (Read only)<br>
    <tt>QString <b>orientation</b></tt> (Read - Write)<br>
    <tt>PaperSize <b>size</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote>
    none
</blockquote>

<p><b>Valid Orientation names:</b></p>
<blockquote><tt>
        Portrait, Landscape
</tt></blockquote>

<a name="sr_report_paper_margins"></a>
<h3>sr.report.paper.margins</h3>

<p>Class for configure the report's margins.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>qreal <b>bottom</b></tt> (Read - Write)<br>
    <tt>qreal <b>left</b></tt> (Read - Write)<br>
    <tt>qreal <b>right</b></tt> (Read - Write)<br>
    <tt>qreal <b>top</b></tt> (Read - Write)<br>
    <tt>QString <b>unit</b></tt> (Read - Write)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    void <b>setMargins</b>(qreal top, qreal right, qreal bottom, qreal left, QString unit);<br>
    void <b>updateUnit</b>(QString unit);
</tt></blockquote>

<p><b>Valid Unit names:</b></p>
<blockquote><tt>
        Millimeter, Point, Inch, Pica, Didot, Cicero, Centimeter, mm = Millimeter, cm = Centimeter, pt = Point, in = Inch, pc = Pica
</tt></blockquote>

<a name="sr_report_paper_size"></a>
<h3>sr.report.paper.size</h3>

<p>Class for configure the report's paper size.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>qreal <b>height</b></tt> (Read - Write)<br>
    <tt>QString <b>size</b></tt> (Read - Write)<br>
    <tt>QString <b>unit</b></tt> (Read - Write)<br>
    <tt>qreal <b>width</b></tt> (Read - Write)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    void <b>setSize</b>(qreal height, qreal width, QString unit);<br>
    void <b>updateUnit</b>(QString unit);
</tt></blockquote>

<p><b>Valid Size names:</b></p>
<blockquote><tt>
        A4, B5, Letter, Legal, Executive,
        A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
        B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
        DLE, Folio, Ledger, Tabloid, Custom
</tt></blockquote>

<p><b>Valid Unit names:</b></p>
<blockquote><tt>
        Millimeter, Point, Inch, Pica, Didot, Cicero, Centimeter, mm = Millimeter, cm = Centimeter, pt = Point, in = Inch, pc = Pica
</tt></blockquote>

<a name="sql_plugin"></a>
<h2>Sql plugin</h2>

<p><b>QScriptExtensionPlugin</b> that provide <b>QSql</b> wrapper classes. For use this plugin import the <tt>srsql</tt> extension.</p>

<p>By default, all wrapper class throw an error when a sql error has happened, for disable this behavior, set <tt>autoThrow</tt> 
property to <tt>false</tt>.</p>

<p><b>Important:</b> All database connections opened will be closed when the script engine is destroyed; in consecuence, all
connections created in the script will be removed.</p>

<a name="sr_sql"></a>
<h3>sr.sql</h3>

<p>Wrapper class around <b>QSqlDatabase</b>'s static members.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>bool <b>autoThrow</b></tt> (Read - Write)<br>
    <tt>QStringList <b>connectionNames</b></tt> (Read only)<br>
    <tt>QStringList <b>drivers</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    Database <b>addDatabase</b>(QString type, QString connectionName = QLatin1String(defaultConnection));<br>
    Database <b>cloneDatabase</b>(Database other, QString connectionName);<br>
    bool <b>contains</b>(QString connectionName = QLatin1String(defaultConnection));<br>
    Database <b>database</b>(QString connectionName = QLatin1String(defaultConnection), bool open = true);<br>
    bool <b>isDriverAvailable</b>(QString name);<br>
    void <b>removeDatabase</b>(QString connectionName);
</tt></blockquote>

<a name="database"></a>
<h3>class Database</h3>

<p>Wrapper class around <b>QSqlDatabase</b>'s instance members, and also, provides the <tt>query</tt> method for create a
<b>QSqlQuery</b> object.</p>


<p><b>Properties:</b></p>

<blockquote>
    <tt>bool <b>autoThrow</b></tt> (Read - Write)<br>
    <tt>QString <b>connectionName</b></tt> (Read only)<br>
    <tt>QString <b>connectOptions</b></tt> (Read - Write)<br>
    <tt>QString <b>databaseName</b></tt> (Read - Write)<br>
    <tt>QString <b>driverName</b></tt> (Read only)<br>
    <tt>QString <b>hostName</b></tt> (Read - Write)<br>
    <tt>bool <b>isOpen</b></tt> (Read only)<br>
    <tt>bool <b>isOpenError</b></tt> (Read only)<br>
    <tt>bool <b>isValid</b></tt> (Read only)<br>
    <tt>ScriptableError <b>lastError</b></tt> (Read only)<br>
    <tt>QString <b>password</b></tt> (Read - Write)<br>
    <tt>int <b>port</b></tt> (Read - Write)<br>
    <tt>QString <b>userName</b></tt> (Read - Write)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    void <b>close</b>();<br>
    bool <b>commit</b>();<br>
    Query <b>exec</b>(QString query = QString());<br>
    bool <b>open</b>();<br>
    bool <b>open</b>(QString user, QString password);<br>
    Query <b>query</b>(QString query = QString());<br>
    Record <b>record</b>(QString tablename);<br>
    bool <b>rollback</b>();<br>
    QStringList <b>tables</b>(QString type = "Tables");<br>
    QString <b>toString</b>();<br>
    bool <b>transaction</b>();
</tt></blockquote>

<p><b>Valid Tables type:</b></p>
<blockquote><tt>
        Tables, SystemTables, Views, AllTables
</tt></blockquote>

<a name="scriptableerror"></a>
<h3>class ScriptableError</h3>

<p>Wrapper class around <b>QSqlError</b>.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>QString <b>databaseText</b></tt> (Read only)<br>
    <tt>QString <b>driverText</b></tt> (Read only)<br>
    <tt>int <b>number</b></tt> (Read only)<br>
    <tt>QString <b>text</b></tt> (Read only)<br>
    <tt>QString <b>type</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    QString <b>toString</b>();
</tt></blockquote>

<a name="query"></a>
<h3>class Query</h3>

<p>Wrapper class around <b>QSqlQuery</b>. <b>Note</b>: for create a new query, use <tt>Database</tt>'s <tt>exec</tt> or 
<tt>query</tt> methods.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>int <b>at</b></tt> (Read only)<br>
    <tt>bool <b>autoThrow</b></tt> (Read - Write)<br>
    <tt>QString <b>executedQuery</b></tt> (Read only)<br>
    <tt>bool <b>isActive</b></tt> (Read only)<br>
    <tt>int <b>isForwardOnly</b></tt> (Read - Write)<br>
    <tt>bool <b>isSelect</b></tt> (Read only)<br>
    <tt>bool <b>isValid</b></tt> (Read only)<br>
    <tt>ScriptableError <b>lastError</b></tt> (Read only)<br>
    <tt>QString <b>lastQuery</b></tt> (Read only)<br>
    <tt>int <b>numRowsAffected</b></tt> (Read only)<br>
    <tt>int <b>size</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    void <b>addBindValue</b>(QVariant val);<br>
    QVariant <b>boundValue</b>(int pos);<br>
    QVariant <b>boundValue</b>(QString placeholder);<br>
    QMap<QString, QVariant> <b>boundValues</b>();<br>
    void <b>clear</b>();<br>
    void <b>bindValue</b>(int pos, QVariant val);<br>
    void <b>bindValue</b>(QString placeholder, QVariant val);<br>
    bool <b>isNull</b>(QString field);<br>
    bool <b>isNull</b>(int field);<br>
    bool <b>exec</b>();<br>
    bool <b>exec</b>(QString query);<br>
    bool <b>execBatch</b>(QString mode = "ValuesAsRows");<br>
    void <b>finish</b>();<br>
    bool <b>first</b>();<br>
    bool <b>last</b>();<br>
    QVariant <b>lastInsertId</b>();<br>
    bool <b>next</b>();<br>
    bool <b>nextResult</b>();<br>
    bool <b>prepare</b>(QString query);<br>
    bool <b>previous</b>();<br>
    Record <b>record</b>();<br>
    bool <b>seek</b>(int i, bool relative = false);<br>
    QVariant <b>value</b>(int i);<br>
    QVariant <b>value</b>(QString field);
</tt></blockquote>

<p><b>Vaild Modes values:</b></p>
<blockquote><tt>
        ValuesAsRows, ValuesAsColumns
</tt></blockquote>

<a name="record"></a>
<h3>class Record</h3>

<p>Wrapper class around <b>QSqlRecord</b>.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>bool <b>autoThrow</b></tt> (Read - Write)<br>
    <tt>int <b>count</b></tt> (Read only)<br>
    <tt>bool <b>isEmpty</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    bool <b>contains</b>(QString name);<br>
    QString <b>fieldName</b>(int i);<br>
    int <b>indexOf</b>(QString name);<br>
    bool <b>isGenerated</b>(int i);<br>
    bool <b>isGenerated</b>(QString name);<br>
    bool <b>isNull</b>(int i);<br>
    bool <b>isNull</b>(QString name);<br>
    QVariant <b>value</b>(int i);<br>
    QVariant <b>value</b>(QString name);
</tt></blockquote>

<a name="internationalization_plugin"></a>
<h2>Internationalitation plugin</h2>

<p><b>QScriptExtensionPlugin</b> that provide internationalization wrapper classes, like <b>QLocale</b>, <b>QTranslator</b>, or
the ability to install translators and the translator functions. For use this plugin import the <tt>sri18n</tt> extension.</p>

<a name="sr_i18n"></a>
<h3>sr.i18n</h3>

<p>Wrapper class around <b>QLocale</b>'s static members, and also, this class allow to install translator and translator functions,
and <tt>openTranslator</tt> method (like to <b>QTranslator</b> <tt>load</tt> method).</p>

<p><b>Note</b>: the <tt>installApplicationTranslatorFunctions</tt> function works with the <b>QScriptEngine</b> translators functions,
the <tt>installTranslatorFunctions</tt> function work with its own implementation.</p>

<p><b>Note</b>: the <tt>installApplicationTranslator</tt> and <tt>installPermanentApplicationTranslator</tt> methods install translator
using <b>QCoreApplication</b>, <tt>installTranslatorFunctions</tt> methods install translators internally (not use 
<b>QCoreApplication</b> and don't generate a <b>LanguageChange</b> event), but these translators only are avaiable installing the
translators functions using <tt>installTranslatorFunctions</tt> method.</p>

<p><b>Important</b>: All installed translators will be removed when the script engine is destroyed, except all translators installed 
using <tt>installPermanentApplicationTranslator</tt> methods.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>Locale <b>cLocale</b></tt> (Read only)<br>
    <tt>QString <b>currentContext</b></tt> (Read only)<br>
    <tt>Locale <b>defaultLocale</b></tt> (Read - Write)<br>
    <tt>Locale <b>systemLocale</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    QList<QString> <b>countriesForLanguage</b>(QString lang);<br>
    QString <b>countryToString</b>(QString country);<br>
    bool <b>installApplicationTranslator</b>(Translator translator);<br>
    Translator <b>installApplicationTranslator</b>(QString filename, QString directory = QString(), QString searchDelimiters = QString(), QString suffix = QString());<br>
    void <b>installApplicationTranslatorFunctions</b>(QScriptValue object = QScriptValue());<br>
    bool <b>installTranslator</b>(Translator translator);<br>
    Translator <b>installTranslator</b>(QString filename, QString directory = QString(), QString searchDelimiters = QString(), QString suffix = QString());<br>
    void <b>installTranslatorFunctions</b>(QScriptValue object = QScriptValue());<br>
    bool <b>installPermanentApplicationTranslator</b>(Translator translator);<br>
    Translator <b>installPermanentApplicationTranslator</b>(QString filename, QString directory = QString(), QString searchDelimiters = QString(), QString suffix = QString());<br>
    QString <b>languageToString</b>(QString language);<br>
    Locale <b>locale</b>(QString language, QString country = QLatin1String("AnyCountry"));<br>
    Locale <b>localeByName</b>(QString name);<br>
    void <b>removeTranslator</b>(Translator translator);<br>
    Translator <b>openTranslator</b>(QString filename, QString directory = QString(), QString searchDelimiters = QString(), QString suffix = QString());
</tt></blockquote>

<p><b>Valid Languages:</b></p>
<blockquote>
        All language names in <b>QLocale::Language</b>
</blockquote>

<p><b>Valid Countries:</b></p>
<blockquote>
        All country names in <b>QLocale::Country</b>
</blockquote>

<a name="locale"></a>
<h3>class Locale</h3>

<p>Wrapper class around <b>QLocale</b>.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>QString <b>amText</b></tt> (Read only)<br>
    <tt>QString <b>country</b></tt> (Read only)<br>
    <tt>QString <b>decimalPoint</b></tt> (Read only)<br>
    <tt>QString <b>exponential</b></tt> (Read only)<br>
    <tt>bool <b>isImperialSystem</b></tt> (Read only)<br>
    <tt>bool <b>isLeftToRight</b></tt> (Read only, avaiable with Qt 4.7 minimum)<br>
    <tt>bool <b>isMetricSystem</b></tt> (Read only)<br>
    <tt>bool <b>isRightToLeft</b></tt> (Read only, avaiable with Qt 4.7 minimum)<br>
    <tt>QString <b>groupSeparator</b></tt> (Read only)<br>
    <tt>QString <b>name</b></tt> (Read only)<br>
    <tt>QString <b>language</b></tt> (Read only)<br>
    <tt>QString <b>negativeSign</b></tt> (Read only)<br>
    <tt>bool <b>omitGroupSeparator</b></tt> (Read - Write)<br>
    <tt>QString <b>percent</b></tt> (Read only)<br>
    <tt>QString <b>pmText</b></tt> (Read only)<br>
    <tt>QString <b>positiveSign</b></tt> (Read only)<br>
    <tt>bool <b>rejectGroupSeparator</b></tt> (Read - Write)<br>
    <tt>QString <b>zeroDigit</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>

<blockquote><tt>
    QString <b>dateFormat</b>(QString format = "LongFormat");<br>
    QString <b>dateTimeFormat</b>(QString format = "LongFormat");<br>
    QString <b>dayName</b>(int i, QString format = "LongFormat");<br>
    bool <b>equals</b>(Locale other);<br>
    QString <b>monthName</b>(int i, QString format = "LongFormat");<br>
    QString <b>standaloneDayName</b>(int i, QString format = "LongFormat");<br>
    QString <b>standaloneMonthName</b>(int i, QString format = "LongFormat");<br>
    QString <b>timeFormat</b>(QString format = "LongFormat");<br>
    QDate <b>toDate</b>(QString string, QString format = "LongFormat");<br>
    QDateTime <b>toDateTime</b>(QString string, QString format = "LongFormat");<br>
    double <b>toDouble</b>(QString s, bool *ok = 0);<br>
    int <b>toInt</b>(QString s, bool *ok = 0, int base = 0);<br>
    float <b>toFloat</b>(QString s, bool *ok = 0);<br>
    qlonglong <b>toLongLong</b>(QString s, bool *ok = 0, int base = 0);<br>
    short <b>toShort</b>(QString s, bool *ok = 0, int base = 0);<br>
    QString <b>toString</b>(qlonglong i);<br>
    QString <b>toString</b>(qulonglong i);<br>
    QString <b>toString</b>(short i);<br>
    QString <b>toString</b>(ushort i);<br>
    QString <b>toString</b>(int i);<br>
    QString <b>toString</b>(uint i);<br>
    QString <b>toString</b>(double i, char f = 'g', int prec = 6);<br>
    QString <b>toString</b>(float i, char f = 'g', int prec = 6);<br>
    QString <b>toString</b>(QDate date, QString formatStr = "LongFormat");<br>
    QString <b>toString</b>(QTime time, QString formatStr = "LongFormat");<br>
    QString <b>toString</b>(QDateTime dateTime, QString format = "LongFormat");<br>
    QTime <b>toTime</b>(QString string, QString format = "LongFormat");<br>
    uint <b>toUInt</b>(QString s, bool *ok = 0, int base = 0);<br>
    qlonglong <b>toULongLong</b>(QString s, bool *ok = 0, int base = 0);<br>
    ushort <b>toUShort</b>(QString s, bool *ok = 0, int base = 0);
</tt></blockquote>

<p><b>Valid Format types:</b></p>
<blockquote><tt>
        LongFormat, ShortFormat, NarrowFormat
</tt></blockquote>

<p><b>Valid Formar strings:</b></p>
<blockquote>
        <tt>LongFormat</tt>, <tt>ShortFormat</tt>, <tt>NarrowFormat</tt>, Other supported by Qt
</blockquote>

<p><b>Valid Languages:</b></p>
<blockquote>
        All language names in <b>QLocale::Language</b>
</blockquote>

<p><b>Valid Countries:</b></p>
<blockquote>
        All country names in <b>QLocale::Country</b>
</blockquote>

<a name="translator"></a>
<h3>class Translator</h3>

<p>Wrapper class around <b>QTranlator</b>.</p>

<p><b>Properties:</b></p>

<blockquote>
    <tt>bool <b>isEmpty</b></tt> (Read only)
</blockquote>

<p><b>Methods:</b></p>
    
<blockquote><tt>
    QString <b>translate</b>(QString context, QString sourceText, QString disambiguation, int n);<br>
    QString <b>translate</b>(QString context, QString sourceText, QString disambiguation = QString());
</tt></blockquote>

